package game.module.item.response;

import game.constants.Position;
import game.entity.Hero;
import game.module.item.beans.CharacterGoods;
import game.module.item.beans.Goodmodel;
import game.module.item.manager.BodyGoodsManager;
import lion.core.SpringContextHolder;
import lion.message.MyServerResponse;

public class AvatarChange60000 extends MyServerResponse {
	public AvatarChange60000(Hero otherCharacter, Goodmodel model, boolean onOrOff) {
		this(otherCharacter, model.getId(), onOrOff);
	}

	public AvatarChange60000(Hero otherCharacter, int model, boolean onOrOff) {
		setMsgCode(60000);
		writeInt(otherCharacter.getId());
		writeBoolean(onOrOff);
		writeInt(model);
		CharacterGoods wuqigoods = SpringContextHolder.getBean(BodyGoodsManager.class).getGoodsByPostion(otherCharacter, Position.POSTION_WUQI);
		if (wuqigoods != null) {
			writeByte(wuqigoods.getPin());
			writeByte(wuqigoods.getJie());
		} else {
			writeByte(0);
			writeByte(0);
		}
	}
}
